<?php
//error_reporting(E_ALL | E_NOTICE);
define('ROOT_PATH', strtr(dirname( __FILE__ ) ."/",array('\\'=>'/')));

if(isset($_GET['del_cat']) && $_GET['del_cat']=1){
	function empty_all_dir($name, $remove = false){
		if(is_dir($name)){
			if($dir = opendir($name)){
				$dirs = array();
				while($file=readdir($dir)){
					if($file!='..' and $file!='.'){
						if(is_dir($name.'/'.$file)){
							$dirs[]=$file;
						}
						else{
							@unlink($name.'/'.$file);
						}
					}
				}
				closedir($dir);
				foreach($dirs as $dir_){
					empty_all_dir($name.'/'.$dir_, $remove);
				}
				
				if($remove){
					@rmdir($name);
				}
			}		
		}
	}
	
	empty_all_dir(ROOT_PATH.'_cache/category/',true);
	echo "DONE!";
}
//header("Location: http://enbac.com");
?>
